﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace UNF_Event_Posting
{
    public partial class testForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            epDataManager mgr = (epDataManager)Application["epDataManager"];

            List<Category> myCategories = mgr.getAllCategoryItems();
            foreach (var cat in myCategories)
            {
                var item = new ListItem(cat.category, cat.cat_id.ToString());
                this.ListBox1.Items.Add(item);
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            epDataManager mgr = (epDataManager)Application["epDataManager"];
            Guid id;
            var ep = new EventPosting();

            ep.n_number = "n00123456";
            ep.event_name = "Test Event";
            ep.cat_id = 1;
            ep.event_description = "Test Description";
            ep.event_duration = new TimeSpan(2,0,0);
            ep.event_date =DateTime.Parse("2012-02-02");

            id = mgr.createEventPost(ep);
            this.Label1.Text = id.ToString();

            
        }
    }
}